Skip to content

Misc icon tweaks, relax lint rules#36046

Draft
silverwind wants to merge 20 commits into
go-gitea:mainfrom
silverwind:icons
Draft

Misc icon tweaks, relax lint rules#36046
silverwind wants to merge 20 commits into
go-gitea:mainfrom
silverwind:icons

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Nov 27, 2025

  1. Use octicon-repo-locked to indicate private repos, also visible on the repo header now
  2. Use octicon-repo-forked to indicate forked repos
  3. Fix pull icons on pulse page
  4. Remove "gold" color from private icons, we have been removing this color on frontpage repolist, so now the rest of the UI is also consistent. Also remove the now-unused gold color.
Screenshot 2025-11-28 at 00 50 42
Screenshot 2025-11-28 at 00 45 21
Screenshot 2025-11-28 at 00 38 53
Screenshot 2025-11-28 at 00 36 34
Screenshot 2025-11-28 at 00 36 25

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 27, 2025
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 28, 2025
Comment thread templates/repo/icon.tmpl Outdated
Comment thread templates/user/settings/repos.tmpl Outdated
@silverwind
Copy link
Copy Markdown
Member Author

Regarding octicon-repo-locked: I'm not sure it's actually right. I checked GH and they do not use it for the purpose of private repos at all. All they do is show a octicon-lock besides repo names in some places. So I think I will revert this change.

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Nov 28, 2025

Regarding octicon-repo-locked: I'm not sure it's actually right. I checked GH and they do not use it for the purpose of private repos at all. All they do is show a octicon-lock besides repo names in some places. So I think I will revert this change.

Maybe this icon is actually fine. I think a repo book icon with a padlock is better than a padlock only. We do not have a "locked" state yet for repos, so this icon is unambiguous too.

@silverwind
Copy link
Copy Markdown
Member Author

One more minor change, ShowRepoAvatar is now enabled in repo lists, meaning they will render the repo avatar. This affects at least the explore repo list and org repo list.

@lunny
Copy link
Copy Markdown
Member

lunny commented Nov 28, 2025

A repository can fall into several state groups:

  • Group 1: IsMirror, IsFork, IsRegular
  • Group 2: IsTemplate
  • Group 3: Public, Private

We can add icons for the states in Group 1, and use text labels for the other groups to maintain consistency and avoid visual conflicts.

@silverwind
Copy link
Copy Markdown
Member Author

Sounds like a plan, I will try that.

@silverwind silverwind marked this pull request as draft December 1, 2025 13:24
@silverwind
Copy link
Copy Markdown
Member Author

Applied that logic, so there is only 3 states of the repo icon now.

Also, I disabled lint rules that forbid "else-return" constructs. I find those just annoying because they forbid code like this and fixing it breaks the symmetry of the block which looks ugly.

  } else {
    return 'octicon-repo';
  }

@silverwind silverwind changed the title Misc icon tweaks Misc icon tweaks, relax lint rules Dec 4, 2025
Comment thread web_src/js/components/DashboardRepoList.vue Outdated
Signed-off-by: silverwind <me@silverwind.io>
@silverwind silverwind marked this pull request as ready for review December 4, 2025 20:54
@silverwind
Copy link
Copy Markdown
Member Author

Ready now, I think it's a good cleanup and now all repo icons are the same everywhere.

{{else}}
<span class="icon">{{svg "octicon-repo"}}</span>
{{end}}
{{template "repo/icon" (dict "Repo" $repo "Size" 16)}}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to have labels(private, template & etc.) for this repository

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean adding labels in this specific place (and below)?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, it appears that the labels are only shown on the repository detail page. They could also be displayed on the list page, but I’m not sure whether we should enable that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In lists we can add them, yes.

{{else}}
{{svg "octicon-repo"}}
{{end}}
{{template "repo/icon" (dict "Repo" . "Size" 16)}}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the above

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Dec 5, 2025
{{else if $repo.IsMirror}}
<span class="icon">{{svg "octicon-mirror"}}</span>
{{else if $repo.IsTemplate}}
<span class="icon">{{svg "octicon-repo-template"}}</span>
Copy link
Copy Markdown
Contributor

@wxiaoguang wxiaoguang Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsTemplate is missing in icon.tmpl

If intentionally, should the comment #36046 (comment) be added to the template code? ps: I don't understand why IsTemplate is in a separate "group".

Copy link
Copy Markdown
Member

@lunny lunny Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both mirror repositories and regular repositories(public or private) could be template repositories.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If intentionally, should the comment #36046 (comment) be added to the template code? ps: I don't understand why IsTemplate is in a separate "group".

If intentionally, should the comment #36046 (comment) be added to the template code?

Copy link
Copy Markdown
Member Author

@silverwind silverwind Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add it. And yes I've implemented that only group 1 is represented with the icon, all other groups are represented with tags in places that have enough room to display them (not on frontpage repo list).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought maybe we should make an exception for templates. I think it's highly unlikely that a repo is both a mirror and a template, so I guess showing a template icon in such a case would make more sense.

@wxiaoguang wxiaoguang marked this pull request as draft December 12, 2025 03:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request improves icon consistency across the Gitea UI and removes the deprecated "gold" color styling for private repositories and organizations. The changes consolidate repository icon logic into a reusable utility function and fix semantically incorrect icon usage.

Changes:

  • Fixed pull request icons on the pulse page (using octicon-git-merge for merged PRs and octicon-git-pull-request for open PRs)
  • Removed gold color styling from private repo/org indicators throughout admin and user settings templates
  • Consolidated repo icon logic into a new getRepoIcon utility function with corresponding template refactoring
  • Relaxed lint rules (no-else-return in ESLint and indent-error-flow in golangci) to accommodate clearer code patterns

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
web_src/js/utils/mappings.ts New utility function getRepoIcon to centralize repo icon logic
web_src/js/components/DashboardRepoList.vue Refactored to use new getRepoIcon utility, removing duplicate icon selection logic
web_src/css/themes/theme-gitea-light.css Removed --color-gold CSS variable
web_src/css/themes/theme-gitea-dark.css Removed --color-gold CSS variable
web_src/css/base.css Removed .text.gold class definition
templates/user/settings/repos.tmpl Replaced inline icon logic with repo/icon template calls
templates/shared/repo/list.tmpl Updated to use repo/icon template; fixed fork count icon from octicon-git-branch to octicon-repo-forked
templates/repo/pulse.tmpl Fixed PR icons: octicon-git-merge for merged, octicon-git-pull-request for proposed
templates/repo/icon.tmpl Refactored to accept dict parameters (Repo, Size, ShowRepoAvatar, ShowRepoOwnerAvatar)
templates/repo/header.tmpl Updated to use new repo/icon template syntax with dict params
templates/org/team/repositories.tmpl Updated to use new repo/icon template syntax with dict params
templates/admin/repo/list.tmpl Removed gold color class from private owner indicators
templates/admin/packages/list.tmpl Removed gold color class from private owner indicators
templates/admin/org/list.tmpl Removed gold color class from private org indicators
eslint.config.ts Relaxed no-else-return rule to allow clearer code patterns
.golangci.yml Removed indent-error-flow rule to allow more flexible error handling patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread templates/repo/icon.tmpl Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: silverwind <me@silverwind.io>
@wxiaoguang
Copy link
Copy Markdown
Contributor

No idea why "experienced" programmers never wrote comments, just keep making others guess.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/code-linting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants